using System;
using System.Collections.Generic;
using System.Text;

namespace Client
{
    public class RepositoryManager
    {
        private string login;
        private string password;

        private RepositoryManager(string _login, string _password)
        {
            login    = _login;
            password = _password;
        }
        
        private static RepositoryManager repositoryManager = null;
        public  static RepositoryManager GetRepositoryManager(string login, string password)
        {
            //if (repositoryManager == null)
            {
                repositoryManager = new RepositoryManager(login, password);
            }
            
            return repositoryManager;
        }

        private IPositionRepository positionRepository;
        public  IPositionRepository PositionRepository
        {
            get
            {
                if (positionRepository == null)
                {
                    return new PositionRepository(login, password);
                }
                return positionRepository;
            }
        }

        private IBankAccountRepository bankAccountRepository;
        public  IBankAccountRepository BankAccountRepository
        {
            get
            {
                if (bankAccountRepository == null)
                {
                    return new BankAccountRepository(login, password);
                }
                return bankAccountRepository;
            }
        }

        private IPaymentRepository paymentRepository;
        public  IPaymentRepository PaymentRepository
        {
            get
            {
                if (paymentRepository == null)
                {
                    return new PaymentRepository(login, password);
                }
                return paymentRepository;
            }
        }

        private ITimeTableRepository timeTableRepository;
        public  ITimeTableRepository TimeTableRepository
        {
            get
            {
                if (timeTableRepository == null)
                {
                    return new TimeTableRepository(login, password);
                }
                return timeTableRepository;
            }
        }

        private ITaskRepository taskRepository;
        public  ITaskRepository TaskRepository
        {
            get
            {
                if (taskRepository == null)
                {
                    return new TaskRepository(login, password);
                }
                return taskRepository;
            }
        }

        private IEmployeeRepository employeeRepository;
        public  IEmployeeRepository EmployeeRepository
        {
            get
            {
                if (employeeRepository == null)
                {
                    return new EmployeeRepository(login, password);
                }
                return employeeRepository;
            }
        }
    }
}
